<extend name="./Application/Admin/View/Layout/application.html"/>

<block name="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="page-header">
                    <h1>新增栏目
                        <small>Create Category</small>
                    </h1>
                </div>

                <div class="row">
                    <div class="col-md-10">
                        <div class="panel panel-default">
                            <div class="panel-heading">栏目修改</div>

                            <div class="panel-body">
                                <!-- Nav tabs -->
                               <ul class="nav nav-tabs" role="tablist">
                                    <li role="presentation" class="active"><a href="#home" role="tab" data-toggle="tab">修改文章</a>
                                    </li>
                                    <li role="presentation"><a href="#profile" role="tab" data-toggle="tab">文章内容</a>
                                    </li>
                                </ul>

                                <!-- Tab panes -->
                                <form class="form-horizontal" role="form" method="post" action="{{:U('update')}}">
                                    <input type="hidden" name="id" value="{{$category.id}}">
                                    <div class="tab-content">
                                        <div role="tabpanel" class="tab-pane fade in active" id="home">
                                            <div class="form-group">
                                                <label for="parent_id" class="col-sm-2 control-label">父栏目</label>
                                                <div class="col-sm-10">
                                                    <select class="form-control" id="parent_id">
                                                        <volist name="categories" id="c">
                                                            <option value="{{$c.id}}">{{$c.name}}</option>
                                                        </volist>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="name" class="col-sm-2 control-label">名称</label>
                                                <div class="col-sm-10">
                                                    <input type="text" name="name" class="form-control" id="name"
                                                           placeholder="栏目名称" value="{{$category.name}}">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="pinyin" class="col-sm-2 control-label">拼音</label>
                                                <div class="col-sm-10">
                                                    <input type="text" name="pinyin" class="form-control"
                                                           id="pinyin"
                                                           placeholder="栏目名称" value="{{$category.pinyin}}">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="name" class="col-sm-2 control-label">类型</label>
                                                <div class="col-sm-10">
                                                    <label class="radio-inline">
                                                        <input type="radio" name="type" id="inlineRadio1" value="1"<eq name="category.type" value="1">checked</eq>> 封面
                                                    </label>
                                                    <label class="radio-inline">
                                                        <input type="radio" name="type" id="inlineRadio2" value="2"<eq name="category.type" value="2">checked</eq>>
                                                        列表
                                                    </label>
                                                    <label class="radio-inline">
                                                        <input type="radio" name="type" id="inlineRadio3" value="3" <eq name="category.type" value="3">checked</eq>>
                                                        URL跳转
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="url" class="col-sm-2 control-label">Url跳转地址</label>
                                                <div class="col-sm-10">
                                                    <input type="text" name="url" class="form-control" id="url"
                                                           placeholder="栏目名称"  value="{{$category.url}}">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="is_show" class="col-sm-2 control-label">是否显示</label>
                                                <div class="col-sm-10">
                                                    <label class="radio-inline">
                                                        <input type="radio" name="is_show" id="is_show" value="1"
                                                        <eq name="category.is_show" value="1">checked</eq>> 显示
                                                    </label>
                                                    <label class="radio-inline">
                                                        <input type="radio" name="is_show" id="" value="0" <eq name="category.is_show" value="0">checked</eq>>  隐藏
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div role="tabpanel" class="tab-pane fade" id="profile">
                                            <br>
                                            <div class="form-group">
                                                    <textarea name="content" rows="10" class="form-control"
                                                    ></textarea>
                                            </div>

                                        </div>
                                        <div role="tabpanel" class="tab-pane fade" id="profile_1">
                                            <br>
                                            <div class="form-group">
                                                <textarea name="content" rows="10" class="form-control">{{$category.content}}</textarea>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <button type="submit" class="btn btn-primary">添 加</button>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>

<block name="js">
    <script src="__PUBLIC__/ckeditor/ckeditor.js"></script>
    <script src="__PUBLIC__/ckfinder/ckfinder.js"></script>
    <script>
        CKEDITOR.replace('content',
                {
                    filebrowserBrowseUrl: '__PUBLIC__/ckfinder/ckfinder.html',
                    filebrowserImageBrowseUrl: '__PUBLIC__/ckfinder/ckfinder.html?type=Images',
                    filebrowserFlashBrowseUrl: '__PUBLIC__/ckfinder/ckfinder.html?type=Flash',
                    filebrowserUploadUrl: '__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                    filebrowserImageUploadUrl: '__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                    filebrowserFlashUploadUrl: '__PUBLIC__/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
                });
    </script>

    <script type="text/javascript">
        $('select ').select2({
            language: "zh-CN"
        });
        //删除新增附件
        //$(document).on...
        $(document).on("click",".delete_file",function(){
            $(this).parents(".form-group").remove();
        });
        //删除第一个附件
        $("#delete_file1").click(function(){
            $("#file1").var('');
        });
    </script>

</block>